import { defineStore } from "pinia";
import piniaPersistConfig from "@/stores/helper/persist";

export const useMobileStore = defineStore({
  id: "mobile-info",
  state: (): any => ({
    userId: 1,
    avatar: "",
    name: ""
  }),
  getters: {},
  actions: {
    setUserId(userId: string) {
      this.userId = userId;
    },
    setUserAvatar(avatar: string) {
      this.avatar = avatar;
    },
    setUserName(name: string) {
      this.name = name;
    },
    clear() {
      (this.userId = 1), (this.avatar = "");
      this.name = "";
    }
  },
  persist: piniaPersistConfig("mobile-info")
});
